<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>12-搜索案例</title>
        <!-- 引入Vue -->
        <script type="text/javascript" src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="app">
            <input type="text" v-model="str">
            <ul>
                <li v-for="(item,index) in newArr" :key="index">{{item}}</li>
            </ul>
        </div>
    </body>

    <script type="text/javascript">
        new Vue({
            el: "#app",
            data: {
                str: "",
                arr: ["小w","小z","中w","中z","大w","大z"],
            },
           computed: {
                newArr(){
                    return this.arr.filter(item=>{
                        return item.indexOf(this.str) !== -1
                    })
                } 
           }
        })
        
    </script>
</html>